package com.sqlcheck.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyBatisPlusConfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        
        // 分页插件
        PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor(DbType.MARIADB);
        paginationInterceptor.setMaxLimit(1000L); // 设置最大分页限制
        paginationInterceptor.setOverflow(false); // 禁止分页溢出
        
        interceptor.addInnerInterceptor(paginationInterceptor);
        
        return interceptor;
    }
}